package com.own.component.util.excel.util.write.style.item;

import com.own.component.util.excel.util.write.style.base.AbstractStyleFunction;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.VerticalAlignment;

/**
 * StyleItemVerticalAlignment
 * <p>
 * 垂直位置
 *
 * @author chenxueli
 * @date 2023-05-11 15:53:00
 */
public class StyleItemVerticalAlignment extends AbstractStyleFunction<VerticalAlignment> {

    public static final StyleItemVerticalAlignment TOP = new StyleItemVerticalAlignment(VerticalAlignment.TOP);
    public static final StyleItemVerticalAlignment CENTER = new StyleItemVerticalAlignment(VerticalAlignment.CENTER);
    public static final StyleItemVerticalAlignment BOTTOM = new StyleItemVerticalAlignment(VerticalAlignment.BOTTOM);
    public static final StyleItemVerticalAlignment JUSTIFY = new StyleItemVerticalAlignment(VerticalAlignment.JUSTIFY);
    public static final StyleItemVerticalAlignment DISTRIBUTED = new StyleItemVerticalAlignment(VerticalAlignment.DISTRIBUTED);

    private StyleItemVerticalAlignment(VerticalAlignment item) {
        super(item);
    }

    /**
     * 使用样式
     *
     * @param style 样式
     */
    @Override
    public void apply(CellStyle style) {
        style.setVerticalAlignment(super.getItem());
    }

}
